import {addClass,getClass} from "@/api/class"

const state = {
    classList:[]
}

const mutations ={
    // 添加课程
    // ADD_CLASS(state,payload){
    //     state.classList = [...payload]
    // },
    GET_CLASS(state,payload){
        state.classList = payload
    }   
}



const actions ={
    async addClass({commit},classInfo){
        let res = await  addClass(classInfo); 
        console.log(res,"res")
    },
    async getClass({commit}){
        console.log("ok")
        let res = await getClass()
        commit("GET_CLASS",res.data)
        return {
            code:200,
            msg:"ok",
            data:res.data
        }
    }
}

export default {
    state,
    mutations,
    actions
}